<%= nested_form_for @project, :html => {:class => 'project-form'} do |f| %>
    <div class="project_form">
      <div class="content_middle">
        <div class="fields_content">
          <div class="fields_content_container">
            <div class="fields_content_heading">
              <h2>Project Information</h2>
            </div>
            <div class="fields_content_data new_project_fields custom_field">
              <div class="fields_content_left">

                <div class="field_row description">
                  <div class="label_field left single"><%= f.label :project_name, content_tag(:span, t('project_name')) %></div>
                  <div class="medium_field">
                    <div> <%= f.text_field :project_name %> </div>
                  </div>
                </div>

                <div class="field_row description">
                  <div class="label_field left single"><%= f.label :client_id, "Client" %></div>
                  <div class="medium_field">
                    <%= f.select :client_id, options_for_select(load_clients_for_project, selected: f.object.client_id),  {:prompt => "", :include_blank => ""}, {"data-placeholder" => "Select a client...", :class => "report_client medium chzn-select", "data-form-container" => "clients_holder", "data-dropdown-width" => "300"} %>
                  </div>
                </div>

                <div class="field_row description" style="display:none;">
                  <div class="label_field left single"><%= f.label :billing_method %></div>
                  <div class="medium_field">
                    <%= f.select :billing_method, options_for_select(load_billing_methods_for_project, selected: f.object.billing_method),  {}, {:class => "report_billing_method medium chzn-select", "data-form-container" => "billing_holder", "data-dropdown-width" => "300"} %>
                  </div>
                  <ul class="field_description select">
                    <li><%= t('views.projects.billing_method_hint') %></li>
                  </ul>
                </div>

                <div class="field_row description">
                  <div class="label_field left single"><%= f.label :total_hours, "Time Estimate" %></div>
                  <div class="">
                    <div> <%= f.number_field :total_hours, min: 0 %> hours </div>
                  </div>
                  <ul class="field_description select">
                    <li><%= t('views.projects.time_estimate_hint') %></li>
                  </ul>
                </div>


              </div>

              <div class="fields_content_right">

                <div class="field_row description">
                  <div class="label_field left single"><%= f.label :description %></div>
                  <div class="medium_field">
                    <div> <%= f.text_area :description %> </div>
                  </div>
                </div>

                <div class="field_row description">
                  <div class="label_field left single"><%= f.label :manager_id, 'Project Manager' %></div>
                  <div class="medium_field">
                    <%= f.select :manager_id, options_for_select(load_managers_for_project(action_name, @project.company_id, f.object.manager), selected: f.object.manager_id),  {:prompt => "", :include_blank => ""}, {"data-placeholder" => "Select a manager...", :class => "report_manager medium chzn-select", "data-form-container" => "staffs_holder", "data-dropdown-width" => "300"} %>
                  </div>
                  <ul class="field_description select" style="display: none;">
                    <li><%= t('views.projects.manager_hint') %></li>
                  </ul>
                </div>

               

              </div>
            </div>
          </div>
        </div>
        <div class="fields_content">
          <div class="fields_content_container">
            <div class="fields_content_heading">
              <h2>Assigned Tasks </h2>
            </div>
            <div class="fields_content_data new_project_fields custom_field">
              <div class="grid_table">
                <table cellpadding="0" cellspacing="0" class="project_grid_fields project_task_fields" id="project_grid_fields">
                  <colgroup>
                    <col class="one"/>
                    <col class="two"/>
                    <col class="three"/>
                    <col class="four"/>
                  </colgroup>
                  <tr>
                    <th class="align_center">&nbsp;</th>
                    <th class="align_center"><%= t('views.tasks.name') %></th>
                    <th class="align_center"><%= t('views.tasks.description') %></th>
                    <th class="align_center"><%= t('views.tasks.rate') %></th>
                  </tr>
                  <%= f.fields_for :project_tasks, :wrapper => false %>
                  <tr style="border:none;" class="no_hover">
                    <td>&nbsp</td>
                    <td class="add_task_row" colspan="2"><%= f.link_to_add t("views.projects.add_task"), :project_tasks, :class => "btn btn-mini", id: 'add_task' %></td>
                  </tr>
                </table>

              </div>
              <!--grid_table-->
            </div>
          </div>
        </div>
        <div class="fields_content">
          <div class="fields_content_container">
            <div class="fields_content_heading">
              <h2>Assigned Team Members </h2>
            </div>
            <div class="fields_content_data new_project_fields custom_field">
              <div class="grid_table">
                <table cellpadding="0" cellspacing="0" class="project_grid_fields project_team_member_fields" id="project_grid_fields">
                  <colgroup>
                    <col class="one"/>
                    <col class="two"/>
                    <col class="three"/>
                    <col class="four"/>
                  </colgroup>
                  <tr>
                    <th class="align_center">&nbsp;</th>
                    <th class="align_center"><%= t('views.staffs.name') %></th>
                    <th class="align_center"><%= t('views.staffs.email') %></th>
                    <th class="align_center"><%= t('views.staffs.rate') %></th>
                  </tr>
                  <%= f.fields_for :team_members, :wrapper => false %>
                  <tr style="border:none;" class="no_hover">
                    <td>&nbsp</td>
                    <td class="add_member_row" colspan="2"><%= f.link_to_add t("views.projects.add_team"), :team_members, :class => "btn btn-mini", id: 'add_member' %></td>
                  </tr>
                </table>

              </div>
              <!--grid_table-->
            </div>
          </div>
        </div>
      </div>

    </div>
<% end %>
<div class="content_bottom">
  <% button_name = @project.persisted? ? 'Update Project' : 'Create Project' %>
  <%= button_tag button_name, class: "btn_large submit project-submit-btn" %>
  <%= link_to t("views.common.cancel"), projects_path, :class => 'btn_large grey' %>
</div><!--content_bottom-->
